<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>静态方法</title>
  </head>
  <body></body>
  <script>
    //构造函数
    function User(name) {
      this.name = name;
    }
    User.prototype.show = function() {
      console.log("prototype.show");
    };
    User.__proto__.show = function() {
      console.log("static.show");
    };

    let user = new User("向边");
    user.show();
    User.show();
    console.dir(user);
    console.dir(User);

    //类
    class Member {
      constructor(name, age) {
        this.name = name;
        this.age = age;
      }
      static create(...args) {
        return new this(...args);
      }
    }
    let hd = new Member("后盾人", 23);
    console.log(hd);

    let xj = Member.create("向边", 18);
    console.log(xj);
  </script>
</html>
